import React from 'react'

class Video extends React.Component {
  constructor(props) {
    super(props)
    this.textInput = null
    this.textInputRef = (element) => {
      this.textInput = element
    }
  }

  render() {
    return (
      <div>
        <video ref={this.textInputRef} controls autoPlay name="media">
          <source
            src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm"
            type="video/webm"
          />
        </video>

        <button onClick={() => this.textInput.play()}>开始播放</button>
      </div>
    )
  }
}
export default Video
